#include<iostream>
#include<vector>
#include<map>
using namespace std;
const int N = 1000;
map<int, int>mp;
map<int, int>mp2;
int b[20010];
int a[N];
int n;
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		mp[a[i]] = 1;
	}
	int cnt = 0;
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			if (a[i] == a[j])continue;
			int x = a[i] + a[j];
			if (mp[x] && a[i] != 0 && a[j] != 0) {
				//cout<<"x=="<<x<<endl;
				//cout<<"cnt=="<<cnt<<endl;
				if (!mp2[x])cnt++;
				mp2[x] = 1;
			}
		}
	}
	cout << cnt << endl;
	return 0;
}